package com.yy.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yy.entity.PricingStandard;
import com.yy.mapper.PricingStandardMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
@Service
public class PricingStandardService extends ServiceImpl<PricingStandardMapper, PricingStandard> {

    PricingStandardMapper mapper;
    @Autowired
    public PricingStandardService(PricingStandardMapper mapper){
        this.mapper=mapper;
    }
    public List<PricingStandard> getAll() {
        return mapper.selectList(null);
    }

    public PricingStandard getById(Long id) {
        return mapper.selectById(id);
    }
    public int insert(PricingStandard entity) {
        entity.setUpdateTime(new Date());
        return mapper.insert(entity);

    }
    public int update(PricingStandard entity) {
        return mapper.updateById(entity);
    }
    public boolean delete(Long id) {
        int result= mapper.deleteById(id);
        return result>0;
    }

}